#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <climits>
#include <limits.h>
#include <math.h>
#include <sstream>

using namespace std;

typedef vector<vector<double> > mdouble;

void readFile(mdouble&X, vector<vector<int> >& Y, string file, bool insX0);
void explode(string line, mdouble&X, vector<vector<int> >& Y, bool insX0);
void readFile(mdouble&X, vector<int>& Y, string file, bool insX0);
void explode(string line, mdouble&X, vector<int>& Y, bool insX0);

void saveFile(mdouble&X, vector<int>&y, string file);
void saveFileX(mdouble&X, string file);
void genRandom(string file, string new_file, double desv, int n);
void particionado(mdouble&X, vector<int>&Y, double porcTraining, int numpart);
void loadConfig(int& numPatterns, int& numParticiones, double& porcTT, double& desvioDatos);

int sign(double x);
double prod_punto(vector<double> &x, vector<double> &w);
vector<double> prod_mat(mdouble &X, vector<double> &w);
double normRandom();
double euclideanDist(int n,vector<double>& x,vector<double>& y);
double difference(vector<double>& x ,vector<double>& y, int power);
vector<double> inverse_diagonal(vector<double>& x);
vector<double> prod_vec_mat_diag(vector<double>& v, vector<double>& m);
double norma_vec(vector<double> &x);
double media(vector<double>& x);
double desvio (vector<double> &V);

void view_vi(vector<int>& v);
void view_vd(vector<double>& v);
